<?php 
session_start();
require_once '../models/Product.php';

?>
<!DOCTYPE html>
<html>
<head>
<title>Chi tiết sản phẩm</title>
<?php include '_meta.php';
$productID=$_REQUEST['productID'];
$row=Product::getInfoProduct($productID);
?>
</head>
<body>
<div>
<div id="firstLine">
	<div id="top-bar">
		<?php include '_top_bar.php';?>
	</div>
</div>
<div id="container">
	<div id="header">
		<?php include '_head.php';?>
	</div>
	<?php include '_menu_head.php';?>
	<div id="center">
		<div id="center2">
		<div id="menu-left">
				<?php include '_menu_left.php';?>
			</div>
			<div id="table">
			
				<input type="hidden" name="productID" id="productID" >
				<div><h1><?php echo $row['brandName'].' '.$row['modelName'].' '.$row['seriesName'].'';?></h1>

				<div>
					<div id="ct_img"><a href=""><img src="<?php echo $row['image']?>"></img></a></div>

				</div>
				<div id="thongso">
					<h4>Thông số kỹ thuật:</h4>
					<table>
					<tbody>
					<tr>
						<td>Màn hình:</td>
						<td><?php echo $row['screen'];?></td>
					</tr>
					<tr>
						<td>CPU:</td>
						<td><?php echo $row['cpu'];?></td>
					</tr><tr>
						<td>Ram:</td>
						<td><?php echo $row['ram'];?></td>
					</tr>
					<tr>
						<td>Hệ điều hành:</td>
						<td><?php echo $row['os'];?></td>
					</tr><tr>
						<td>Sim:</td>
						<td><?php echo $row['sim'];?> Sim</td>
					</tr>
					<tr>
						<td>Camera:</td>
						<td><?php echo $row['camera']?></td>
					</tr>
					<tr>
						<td>Bộ nhớ trong:</td>
						<td><?php echo $row['memory_in']?></td>
					</tr>
					<tr>
						<td>Thẻ nhớ ngoài đến:</td>
						<td ><?php echo $row['memory_out']?></td>
					</tr>
					<tr>
						<td>Dung lượng pin:</td><td><?php echo $row['cell'].' mAh'?></td>
					</tr>
					<tr>
						<td><a href="addcart.php?productID=<?php echo $row['productID']?>"><input type="button" value="Mua ngay" class="btn_button_" /></a></td>
					</tr>				<form action ="addcompare.php" method="post">
					<tr>
						<td style="color:red"><h4>So sánh <?php echo $row['brandName'].' '.$row['modelName'].' '.$row['seriesName'].'';?> với &nbsp;</h4></td>
						<td>
							<select id="productID" name="productCID">
								<?php
									$sql = "SELECT
									pr.productID,
									md.modelName,
									sr.seriesName,
									pr.image,
									pr.price,
									br.brandName
									FROM
									tbl_brand AS br ,
									tbl_model AS md ,
									tbl_series AS sr ,
									tbl_product AS pr
									WHERE
									br.brandID = pr.brandID AND
									pr.modelID = md.modelID AND
									pr.seriesID = sr.seriesID AND
									pr.productID NOT IN($productID)
									
									";
									$result = mysql_query($sql);
									while($row=mysql_fetch_array($result)) {
								?>
								<option value="<?php echo $row['productID']; ?> " > <?php echo $row['brandName']; ?> <?php echo $row['modelName']; ?> <?php echo $row['seriesName']; ?></option>
								<?php }?>
							</select>
						</td>
						<td><input type="hidden" name="productID" value='<?php echo $productID ?>' /><input type="submit" value="So Sánh" class="btn_button_" /></td>
					</tr>
					</form>
					</tbody>
					</table>
				</div>
		</div>
	</div>
	</div>
	</div>
</div>
<div id="footer">
		<?php include '_footer.php';?>
	</div>
</body>
</html>